﻿#pragma once
#include "pch.h"
class CPencil;
class CMainDoc : public CDocument
{
	DECLARE_DYNCREATE(CMainDoc) // 添加动态创建支持
	DECLARE_MESSAGE_MAP() // 声明消息映射宏
public:
	CMainDoc();
	~CMainDoc();
public:
	UINT m_nPenWidth;
	CPen m_penCur; 
	// CPencil* 类型的链表
	CTypedPtrList<CObList, CPencil*> m_pencilList;// BASE_CLASS‌：必须为 CObList 或 CPtrList（指针链表基类）‌
	CPen* getCurrentPen() {
		return &m_penCur;
	}
	CPencil* NewPencil(); // 创建铅笔一条线对象
	void InitDocument();
protected:
	virtual BOOL OnNewDocument() override; // 默认会回调，打开新文档 
	virtual BOOL OnOpenDocument(LPCTSTR lpszPathName) override;
	virtual void DeleteContents() override;
	virtual void Serialize(CArchive& ar) override; // 序列化，继承CObject就有，菜单保存自动触发
};

